package lyx.tank.element
{
	import flash.display.BitmapData;
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.geom.Matrix;
	
	import lyx.game.element.DynamicGameElement;
	import lyx.game.utils.Direction;

	
	public class Bullet extends DynamicGameElement
	{
		public var face_style:int = 0x991122;
		
		public var shooter_type:String;
		
		private var _graphics_face:Sprite = new Sprite();
		
		public function Bullet(x:int,y:int,direction:int,owner_type:String,width:Number=10,height:Number=10)
		{
			super(x-width/2,y-height/2,width,height);
			
			this.step_speed = 150;
			this.direction = direction;	
			this.shooter_type = owner_type;
		}
		
		override public function move(time:int):void
		{
			steps = 1;
			super.move(time);
		}
		
		override protected function outActiveAreaHandler():void
		{
			life = 0;
		}
		
		override protected function updateViewContext():void
		{
			_graphics_face.graphics.clear();
			_graphics_face.graphics.beginFill(face_style);
			_graphics_face.graphics.drawCircle(view_data.width/2,view_data.height/2,view_data.width/2);
			_graphics_face.graphics.endFill();
			
			view_data.draw(_graphics_face);
		}
	}
}